using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using System.Data;
namespace BUS
{
    public enum BoPhanBUSResult
    {
        OK ,
        DAOERROR
    }
    public class BoPhan
    {
        public static BoPhanBUSResult SelectAll(List<DTO.BoPhan> dsBoPhan)
        {
            string sql = "select * from BoPhan";
            DAO.Interface bp = new DAO.BoPhan();
            DataTable dt = bp.Select(sql);
            if (dt != null)
            {
                for (int i = 0 ; i < dt.Rows.Count ; i++)
                {
                    DTO.BoPhan temp = new DTO.BoPhan();
                    temp.MaBoPhan = dt.Rows[i].ItemArray[0].ToString();
                    temp.TenBoPhan = dt.Rows[i].ItemArray[1].ToString();
                    dsBoPhan.Add(temp);
                }
                return BoPhanBUSResult.OK;
            }
            return BoPhanBUSResult.DAOERROR;
        }
    }
}
